<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title>DrupalModel后台管理</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="/Thinkphp/Public/jquery-3.0.0.js"></script>
        <style type="text/css">
		body{
                    margin:0;
                    padding:0;
                    text-align:center;
		}
		#title{
                    width:1000px;
                    padding:10px;
                    margin:0px auto;
		}
		#form{
                    width:300px;
                    padding:10px;
                    margin:0px auto;
		}
		#span1{
                    color:rgb(85,85,85);
                    font-size:30px;
                    line-height:32px;
                    display:block;
		}
		#form1{
                    font-size:14px;
                    line-height:19px;
                    width:300px;
		}
		.input{
                    width:240px;
                    padding:2px;
                    border:1px solid blue;
		}
                #captcha{
                    width:100px;
                    height:30px;
                }
	</style> 
    </head>
    <body>
	<div id="title">
		<span id="span1">管理员登录</span>
	</div>
	<div id="form">
            <form id="form1" method="post" action="<?php echo U('Admin/Admin/dologin') ?>">
			用户账号:<input class="input" type="text" id="name" name="name" placeholder="请输入您的账号"/>
			<br/><br/>
			用户密码:<input class="input" type="password" id="pass" name="pass" placeholder="请输入您的密码"/>
			<br/><br/>
                        <p id="p"></p>
                        <br/><br/>
                        <input type="submit" id="login_submit" value="登录">
            </form>
	</div>
        <script>
            $("#login_submit").click(function(){
                var url = "<?php echo U('Admin/Admin/dologin')?>";
                var data= {};
                data ['name'] = $("#name").val();
                data ['pass'] = $("#pass").val();
                var dataType = "json";
                $.post(
                    url,
                    data,
                    function(data){                      
                        if(data.status === 0){
                            location.href="<?php echo U('Admin/Admin/center')?>";
                        }
                        if(data.status === 1){
                            $("#p").html("*用户名或密码错误！").css("color","red");
                        }
                        if(data.status === 2){
                            $("#p").html("*请填写用户名和密码！").css("color","red");
                        }
                    },
                    dataType
                );
               return false; 
            }        
        );
        </script>
    </body>
</html>